#Include <ScreenCapture.au3>
#Include <File.au3>
#Include <Function For PageViewer.au3>
#Include <GuiListView.au3>
#include <Date.au3>

If $bPageViewType <> 1 Then Exit 
$sLogFileName1 = 'PageViewerFormatTraverseSaveAs1'
Common_WriteCurrentFunctionNameToTempTXT($sLogFileName1)
#cs
SaveAs_JPEG_Color_To_()
SaveAs_Gray_TIFF_To_()
SaveAs_BMP_BW_To_()
SaveAs_MULTI_PAGE_TIF_To_()
SaveAs_TIFF_8BIT_To_()
SaveAs_TIFF_16BIT_To_()
SaveAs_JPEG_CMYK_To_()
SaveAs_JPEG_YCCK_To_()
SaveAs_BMP_16BIT_To_()
SaveAs_BMP_24BIT_To_()
SaveAs_BMP_32BIT_To_()
#ce
ImageSaveAs()
Func ImageSaveAs()
	Local  $hPMHandle = '', $hThumbnailView = ''
	Common_Del_DB()
	Common_InitializeStatus()
	InitializeStatusForPageViewer()
	If Assign('hPMHandle', Common_Run_PageManager_Ex('ImageSaveAs', $sLogFileName1)) And $hPMHandle == '' Then Return False
	If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, 'ImageSaveAs', $sLogFileName1)	Then Return False
	If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, 'ImageSaveAs', $sLogFileName1)) And $hThumbnailView == '' Then Return False
	For $i = 0 to 16
		Local $TestCaseID = "JPEG_Color_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''	
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'JPEG_Color.jpg', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'JPEG_Color.jpg')	
	Next	
	
	For $i = 0 to 16
		Local $TestCaseID = "Gray_TIFF_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'Gray_TIFF.tif', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'Gray_TIFF.tif')		
	Next
	
	For $i = 0 to 16
		Local $TestCaseID = "BMP_BW_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BMP_BW.bmp', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'BMP_BW.bmp')		
	Next	
	
	For $i = 0 to 16
		Local $TestCaseID = "MULTI_PAGE_TIF_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'Multi_PAGE.tif', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'Multi_PAGE.tif')		
	Next	

	For $i = 0 to 16
		Local $TestCaseID = "TIFF_8BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'TIFF_8Bit.tif', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'TIFF_8Bit.tif')		
	Next
	
	For $i = 0 to 16
		Local $TestCaseID = "TIFF_16BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'TIFF_16Bit.tif', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'TIFF_16Bit.tif')		
	Next	
	
	For $i = 0 to 16
		Local $TestCaseID = "JPEG_CMYK_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'JPEG_CMYK.jpg', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'JPEG_CMYK.jpg')		
	Next		
	
	For $i = 0 to 16
		Local $TestCaseID = "JPEG_YCCK_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'JPEG_YCCK.jpg', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'JPEG_YCCK.jpg')		
	Next	

	For $i = 0 to 16
		Local $TestCaseID = "BMP_16BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BMP_16Bit.bmp', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'BMP_16Bit.bmp')		
	Next	
	
	For $i = 0 to 16
		Local $TestCaseID = "BMP_24BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BMP_24Bit.BMP', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'BMP_24Bit.BMP')		
	Next		
	
	For $i = 0 to 16
		Local $TestCaseID = "BMP_32BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg',  $hPageViewer = ''		
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BMP_32Bit.bmp', $sFunctionFolderPath, 1)
		Common_SleepInSeconds(1)
		Send('{F5}')
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()	
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf	
		ExitPageViewerByClickCloseButton($hPageViewer)	
		FileDelete($sFunctionFolderPath & 'BMP_32Bit.bmp')		
	Next	
	Common_Close_PM($hPMHandle)	
EndFunc

Func SaveAs_JPEG_Color_To_()
	For $i = 0 to 16
		Local $TestCaseID = "JPEG_Color.jpg" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'JPEG_Color.jpg', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_Gray_TIFF_To_()
	For $i = 0 to 16
		Local $TestCaseID = "Gray_TIFF_To_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'Gray_TIFF.tif', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_BMP_BW_To_()
	For $i = 0 to 16
		Local $TestCaseID = "BMP_BW_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BMP_BW.bmp', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_MULTI_PAGE_TIF_To_()
	For $i = 0 to 16
		Local $TestCaseID = "MULTI_PAGE_TIF_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'Multi_PAGE.tif', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_TIFF_8BIT_To_()
	For $i = 0 to 16
		Local $TestCaseID = "TIFF_8BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'TIFF_8Bit.tif', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_TIFF_16BIT_To_()
	For $i = 0 to 16
		Local $TestCaseID = "TIFF_16BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'TIFF_16Bit.tif', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_JPEG_CMYK_To_()
	For $i = 0 to 16
		Local $TestCaseID = "JPEG_CMYK_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'JPEG_CMYK.jpg', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_JPEG_YCCK_To_()
	For $i = 0 to 16
		Local $TestCaseID = "JPEG_YCCK_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'JPEG_YCCK.jpg', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_BMP_16BIT_To_()
	For $i = 0 to 16
		Local $TestCaseID = "BMP_16BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BMP_16Bit.bmp', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_BMP_24BIT_To_()
	For $i = 0 to 16
		Local $TestCaseID = "BMP_24BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BMP_24Bit.BMP', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc

Func SaveAs_BMP_32BIT_To_()
	For $i = 0 to 16
		Local $TestCaseID = "BMP_32BIT_" & $Saveto_1[$i]
		Local $sCaptureImage = $TestCaseID & '.jpg', $hThumbnailView = '', $hPMHandle = '', $hPageViewer = ''
		Common_Del_DB()
		Common_InitializeStatus()
		InitializeStatusForPageViewer()
		If Assign('hPMHandle', Common_Run_PageManager_Ex($TestCaseID, $sLogFileName1)) And $hPMHandle == '' Then Return False
		ControlClick($hPMHandle, '', $sSwicthToListViewButtonCtrInfo)
		FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'BMP_32Bit.bmp', $sFunctionFolderPath, 1)
		If Not Common_SwitchToFunctionFolder($hPMHandle, $sFolderName, $TestCaseID, $sLogFileName1)	Then Return False
		If Assign('hThumbnailView', Common_GetThumbinalHdanle($hPMHandle, $TestCaseID, $sLogFileName1)) And $hThumbnailView == '' Then Return False
		SelectFileInThumnailThenSwitchToPageviewer($hThumbnailView, 0, $hPMHandle)
		If Assign('hPageViewer', IsPageViewerWindowExist($TestCaseID, $sLogFileName1)) And $hPageViewer == '' Then Return False
		SaveAsFromContextMenu()
		If Not SetSaveAsFileName($TestCaseID, $sLogFileName1, $sPerformResultPath & $TestCaseID) Then Return False	
		Common_SetSaveAsFormat($SaveFormat_1[$i])
		If Not CLickOkOrCancelBtnInSaveAsWnd_EX($TestCaseID, $sLogFileName1, 'OK') Then Return False	
		Common_SleepInSeconds(2)	
		If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".psd" Or $FileFormat_1[$i] == ".png" Or $FileFormat_1[$i] == ".txt" Then
			If $FileFormat_1[$i] == ".htm" Or $FileFormat_1[$i] == ".txt" Then Common_SleepInSeconds(7)
			If FileExists($sPerformResultPath & $TestCaseID & $FileFormat_1[$i]) Then
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')
			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	
			EndIf				
		Else
			Common_SleepInSeconds(8)
			Local $bCompareFile = Common_CompareFile($sPerformResultPath & $TestCaseID & $FileFormat_1[$i], $sCorrectResultPath & $TestCaseID & $FileFormat_1[$i])		
			If $bCompareFile Then	
				Common_WriteLog($sPass, $TestCaseID, $sLogFileName1, '')

			Else
				Common_WriteLog($sFaile & 'Please compare saved file' & @CRLF, $TestCaseID, $sLogFileName1,'')	 
			EndIf
		EndIf
		Common_Close_PM($hPMHandle)	
	Next
EndFunc









